package test_package;

import java.util.ArrayList;
import java.util.Collections;

/**
 * Created by iryna on 3/15/14.
 */
public class test2 {
    public static void main(String[] args) {
        ArrayList<String> textfromfile = new ArrayList<String>();
        textfromfile.add("gshndgfvhsd 10 sdkhfjsdkf");
        textfromfile.add("hjhhhereeh 1 hhhdhgf");
        textfromfile.add("oiyuuiyhoiuyui 90 kugkjygjkygy");

        System.out.println("--------------------------------------------");
        System.out.println("Text from a file " + textfromfile);
        String o1 = "gshndgfvhsd 10 sdkhfjsdkf";
        String o2 = "hjhhhereeh 1 hhhdhgf";
        String o3 = "oiyuuiyhoiuyui 90 kugkjygjkygy";

        // gets rid of non-numeric characters
        int int1 = Integer.parseInt(o1.replaceAll("\\D", ""));
        int int2 = Integer.parseInt(o2.replaceAll("\\D", ""));
        int int3 = Integer.parseInt(o3.replaceAll("\\D", ""));

        ArrayList<Integer> filenumbers = new ArrayList<Integer>();
        filenumbers.add(int1);
        filenumbers.add(int2);
        filenumbers.add(int3);

        ArrayList<Integer> filenumbers_int;
        filenumbers_int = filenumbers;
        System.out.println("--------------------------------------------");
        System.out.println("Unsorted numbers from a file "+filenumbers_int);

        //Sorting Arraylist in Java on natural order of object

        Collections.sort(filenumbers);

//print sorted arraylist on natural order
        System.out.println("--------------------------------------------");
        System.out.println("Sorted numbers from a file "+filenumbers);

        System.out.println(filenumbers.getClass().getName());




    }


}